<?php

namespace app\common\validate;

use think\Validate;

class Rules extends Validate {

    protected $rule = [
        'user_id' => 'require',
        'goods' => 'require',
        'account' => 'require',
        'name' => 'require',
//        'name_english' => 'require',
        'company_name' => 'require',
//        'company_name_english' => 'require',
        'addr' => 'require',
//        'addr_english' => 'require',
        'postcode' => 'require',
        'tel' => 'require',
        'user_name' => 'require',
//        'user_name_english' => 'require',
        'phone' => 'require',
        'email' => 'require',
    ];

    protected $message = [
        'user_id.require' => '登录已失效',
        'goods.require' => '订单商品不能为空',
        'account.require' => '内容不能为空',
        'name.require' => '内容不能为空',
        'name_english.require' => '内容不能为空',
        'company_name.require' => '内容不能为空',
        'company_name_english.require' => '内容不能为空',
        'addr.require' => '内容不能为空',
        'addr_english.require' => '内容不能为空',
        'postcode.require' => '内容不能为空',
        'tel.require' => '内容不能为空',
        'user_name.require' => '内容不能为空',
        'user_name_english.require' => '内容不能为空',
        'phone.require' => '内容不能为空',
        'email.require' => '内容不能为空',
    ];

    protected $scene = [
        'order_confirm' => ['user_id','goods'],
        'registered' => ['account','name','name_english','company_name','company_name_english','addr','addr_english','postcode','tel','user_name','user_name_english','phone','email']
    ];
    
    protected function checkGoods($arr){
        if(is_array($arr)){
            foreach ($arr as $k=>$v){
                foreach ($v['info'] as $key=>$val){
                    
                }
            }
        }
    }
}

